Socket
Socket
Sign inDemoInstall

ansi-align

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-align

align-text with ANSI support for CLIs


Version published
Weekly downloads
9.9M
decreased by-2.21%
Maintainers
1
Weekly downloads
 
Created

What is ansi-align?

The ansi-align npm package is used to align text within the terminal using ANSI escape codes. It allows for centering, right-aligning, or left-aligning strings within a given width, which is useful for creating visually appealing command-line interfaces.

What are ansi-align's main functionalities?

Center alignment

This feature centers the text within a specified width. The code sample demonstrates how to center the text 'Centered Text' within a width of 20 characters.

const ansiAlign = require('ansi-align');
console.log(ansiAlign.center('Centered Text', {width: 20}));

Right alignment

This feature right-aligns the text within a specified width. The code sample demonstrates how to right-align the text 'Right Aligned' within a width of 20 characters.

const ansiAlign = require('ansi-align');
console.log(ansiAlign.right('Right Aligned', {width: 20}));

Left alignment

This feature left-aligns the text within a specified width. The code sample demonstrates how to left-align the text 'Left Aligned' within a width of 20 characters.

const ansiAlign = require('ansi-align');
console.log(ansiAlign.left('Left Aligned', {width: 20}));

Other packages similar to ansi-align

Keywords

FAQs

Package last updated on 01 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc